package com.lgj.utils;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Properties;

public class TestCon {
    private static Connection connection;
    public static void main(String[] args) {
        InputStream is = JDBCUtils.class.getClassLoader().getResourceAsStream("com/lgj/config.properties");
        Properties prop = new Properties();
        Statement statement = null;
        try {
            prop.load(is);
            String driverClass = prop.getProperty("driverClass");
            String url = prop.getProperty("url");
            String user = prop.getProperty("user");
            String password = prop.getProperty("password");
            System.out.println(driverClass);
            System.out.println(url);
            System.out.println(user);
            System.out.println(password);

            Class.forName(driverClass);
//            Class.forName("com.mysql.cj.jdbc.Driver");
            connection = DriverManager.getConnection(url, user, password);
            statement = connection.createStatement();
            System.out.println("aaaaa");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
